package com.itheima.edu.info.manager.day13;

import java.util.concurrent.locks.ReentrantLock;

public class  ZuoHanBao  implements Runnable{
    @Override
    public void run() {
        while (ZhuoZi.a!=0){
            synchronized (ZhuoZi.o){
                if(ZhuoZi.f==false){
                    System.out.println("做汉堡");
                    ZhuoZi.f=true;
                    System.out.println("---"+ZhuoZi.a);
                    //沉睡和唤醒必须与锁一致
                    ZhuoZi.o.notifyAll();
                }else {
                    try {
                        //ZhuoZi.o.notifyAll();

                        //沉睡和唤醒必须与锁一致
                        ZhuoZi.o.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
